part of native_dio_adapter;

class FileUtils {
  static Map<String, dynamic> generateFiles(
    List<String> files, {
    String key = 'files',
    String mediaType = "image/*",
  }) {
    Map<String, List<Map<String, String>>> filesMap = {};
    List<Map<String, String>> multipartFiles = [];
    for (var element in files) {
      String filename = p.basename(element);
      multipartFiles.add(NativeMultipartFile(
        filePath: element,
        fileName: filename,
        mediaType: mediaType,
      ).encode());
    }
    filesMap.putIfAbsent(key, () => multipartFiles);
    return filesMap;
  }
}
